<template>
	<view class="list">
		
		<view @click="toDetail(item)" class="flex align-center border-bottom" v-for="(item,index) in list" :key="index">
			<view class="name" @click.stop="toStock(item)">
				<view>{{item.title}}</view>
				<view class="flex align-center margin-top-xs">
					<image class="tag" :src="`/static/images/icons/${item.marketCode}.png`" mode=""></image>
					<text class="text-sm">{{item.code}}</text>
					<text class="text-red" v-if="item.buytype==3">*{{item.multiplying}}</text>
				</view>
			</view>
			<view class="price">
				<view>{{item.number}}</view>
				<view class="margin-top-xs">{{item.cityValue}}</view>
			</view>
			<view class="price">
				<view>{{item.cai_buy}}</view>
				<view class="margin-top-xs">{{item.buyprice}}</view>
			</view>
			<view class="up-down" :class="item.profitLose>0?'text-red':'text-green'">
				<view>{{item.profitLose}}</view>
				<view class="text-sm margin-top-xs">{{item.profitLose_rate}}</view>
			</view>
		</view>

	</view>
</template>

<script>

export default {
	props: {
		list: {
			type: Array,
			default: ()=>[]
		},
	},
	data() {
		return {
			
		};
	},
	methods: {
		toDetail(item){
			uni.navigateTo({
				url:'/pages/shares/holdDetail-pz?data='+JSON.stringify(item)
			})
		},
		toStock(item) {
			uni.navigateTo({
				url:'/pages/shares/detail?code='+item.allcode
			})
		}
	},
};
</script>

<style lang="scss" scoped>
	.name,.price,.up-down{
		box-sizing: border-box;
		padding: 16rpx;font-size: 26rpx
	}
	.name{width: 25%;}
	.price{width: 24%;text-align: center;}
	.up-down{width: 25%;text-align: right;}
	.tag{width: 36rpx;height: 24rpx;margin-right: 10rpx;}
</style>